home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 326-350 / disk_337 / cmanual / miscellaneous.lzh / Miscellaneous / Example3.c < prev    next >
C/C++ Source or Header  |  1990-02-06  |  1KB  |  56 lines

  1. /* Example3                                                 */
  2. /* This example shows how to get a copy of the preferences. */
  3.  
  4.  
  5. #include <intuition/intuition.h>
  6.  
  7.  
  8.  
  9. struct IntuitionBase *IntuitionBase;
  10.  
  11.  
  12.  
  13. main()
  14. {
  15.   /* Declare a preferences structure: */
  16.   struct Preferences pref;
  17.  
  18.  
  19.  
  20.   /* Open the Intuition Library: */
  21.   IntuitionBase = (struct IntuitionBase *)
  22.     OpenLibrary( "intuition.library", 0 );
  23.   
  24.   if( IntuitionBase == NULL )
  25.     exit(); /* Could NOT open the Intuition Library! */
  26.  
  27.  
  28.  
  29.   /* Try to get a copy of the current preferences (whole): */
  30.   if( GetPrefs( &pref, sizeof(pref) ) == NULL )
  31.   {
  32.     /* Could not get a copy of the preferences! */
  33.     CloseLibrary( IntuitionBase );
  34.     exit();
  35.   }
  36.  
  37.  
  38.  
  39.   /* We have now a copy of the preferences. */
  40.   /* Do what ever you want...               */
  41.  
  42.   /* Why not print out the workbench clours? */
  43.   printf( "\nWorkbench Screen Colours:\n");
  44.   printf( "             RGB\n" );
  45.   printf( "Colour 0: 0x%04x\n", pref.color0 );
  46.   printf( "Colour 1: 0x%04x\n", pref.color1 );
  47.   printf( "Colour 2: 0x%04x\n", pref.color2 );
  48.   printf( "Colour 3: 0x%04x\n\n", pref.color3 );
  49.  
  50.  
  51.  
  52.   /* Close the Intuition Library: */
  53.   CloseLibrary( IntuitionBase );
  54. }
  55.  
  56.